import os
import numpy as np
import pandas as pd
import os
import time
import glob
import re
import warnings
from program.pack.append_df_to_excel import append_df_to_excel
from pandas import to_datetime
from functools import reduce

warnings.filterwarnings("ignore")

# 列显示不全，进行设置
pd.set_option('display.max_columns', 500)
pd.set_option('display.unicode.ambiguous_as_wide', True)
pd.set_option('display.unicode.east_asian_width', True)
pd.set_option('display.width', 180)  # 设置打印宽度(**重要**)

path_input = r"W:\wangshuan\Tai-30\zonce\21-12-30-TAI30-zonce"
for root_dirs, sub_dirs, files in os.walk(path_input):
    # 读取xlsx,以key_id为键
    for file in files:
        # 进行条件筛选   以非~$'开头(解决读取文档已打开问题)；选择以file_name_0结尾的文档
        if '12-31' in file:
            # print(file)
            file = os.path.join(root_dirs, file)
            new_file = file.replace('12-30-2#', '12-31-2#')
            print(file)
            print(new_file)
            #
            # # 将  'α'修改为'1'
            # try:
            #     if os.path.isdir(file):
            #         os.rename(file, new_file)
            #         print('1', file)
            #     else:
            #         os.rename(file, new_file)
            #         print('2', file, new_file)
            # except Exception as e:
            #     print(file, e)
            #
